package com.zr.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zr.service.UpdateteaServiceljc;
import com.zr.serviceImpl.UpdateteaServiceImplljc;

public class UpdateteaControllerljc extends HttpServlet{
	//修改教师信息控制器
	UpdateteaServiceljc upts = new UpdateteaServiceImplljc();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("utf8");
		resp.setCharacterEncoding("utf8");
		PrintWriter pw = resp.getWriter();
		int tid = Integer.parseInt(req.getParameter("tid"));
		String tname = req.getParameter("tname");
		String tage = req.getParameter("tage");
		String tsex = req.getParameter("tsex");
		String address = req.getParameter("address");
		String tpnumber = req.getParameter("tpnumber");	
		boolean flag = upts.updatetea(tid, tname, tage, tsex, address, tpnumber);
		if(flag){
			pw.write("1");
		}else{
			pw.write("0");
		}
		pw.flush();
		pw.close();
	}
}
